package LeetCode.剑指Offer._220531;

/**
 * @Author: yqy
 * @Date: 2022/05/31/16:54
 * @Description:找不同
 */
public class _389 {
    public static void main(String[] args) {
       /* char c = findTheDifference("a", "aa");
        System.out.println(c);*/
    }

    public static char findTheDifferencePlus(String s, String t) {
        int sChar=0;int tChar=0;
        for (int i = 0; i < s.length(); i++) {
            sChar +=s.charAt(i);
        }
        for (int i = 0; i < t.length(); i++) {
            tChar +=t.charAt(i);
        }
        return (char) (tChar-sChar);
    }
    public static char findTheDifference(String s, String t) {
        for (int i = 0; i < t.length(); i++) {
            char c = t.charAt(i);
            boolean flag=false;
            for (int j = 0; j < s.length(); j++) {
                if (c==s.charAt(j)){
                    flag=true;
                }
            }
            if (!flag){
                return c;
            }
        }
        return ' ';
    }
}
